// import { getAsyncComponent } from "../util/getAsyncComponent";
// const Home = getAsyncComponent('/home/index.vue');
// const About = getAsyncComponent('/about/index.vue');

// import Home from '../views/home/index.vue';
// import All from '../views/all/index.vue';
// import About from '../views/about/index.vue';
// import More from '../views/more/index.vue';
// import NotFound from '../components/NotFound.vue';

import {  defineAsyncComponent } from 'vue';
import Layout from '../layout.vue';
const Home = defineAsyncComponent(() => import('../views/home/index.vue'));
const Bookmark = defineAsyncComponent(() =>
  import('../views/bookmark/index.vue')
);
const Memo = defineAsyncComponent(() => import('../views/memo/index.vue'));
const MemoEdit = defineAsyncComponent(() => import('../views/memo/edit.vue'));
const MemoDetail = defineAsyncComponent(() => import('../views/memo/detail.vue'));
const More = defineAsyncComponent(() => import('../views/more/index.vue'));

const Photos=defineAsyncComponent(()=> import('../views/photos/index.vue'))

const Weather = defineAsyncComponent(() => import('../views/weather/index.vue'));

const Login = defineAsyncComponent(() => import('../views/login/index.vue'));
const Register = defineAsyncComponent(() => import('../views/register/index.vue'));

const NotFound = defineAsyncComponent(() =>
  import('../components/NotFound.vue')
);

const routes = [
  {
    path: '',
    redirect: '/index/home',
  },
  {
    path: '/index',
    component: Layout,
    children: [
      {
        path: 'home',
        name: 'Home',
        component: Home,
        meta: {
          keepAlive: true,
          title: '首页',
        },
      },
      {
        path: 'book',
        name: 'Book',
        component: Bookmark,
        meta: {
          keepAlive: false,
          title: '书签和清单',
        },
      },
      {
        path: 'memo',
        name: 'Memo',
        component: Memo,
        meta: {
          keepAlive: false,
          title: '便签',
        },
      },
      {
        path: 'memoEdit',
        name: 'MemoEdit',
        component: MemoEdit,
        meta: {
          keepAlive: false,
          title: '便签',
          isEdit: true,
        },
      },
      {
        path: 'memoDetail',
        name: 'MemoDetail',
        component: MemoDetail,
        meta: {
          keepAlive: false,
          title: '便签详情',
        },
      },
      {
        path: 'photos',
        name: 'Photos',
        component: Photos,
        meta: {
          keepAlive: false,
          title: '图库',
        },
      },
      {
        path: 'more',
        name: 'More',
        component: More,
        meta: {
          keepAlive: true,
          title: '更多',
        },
      },
    ],
  },
  {
    path: '/weather',
    name: 'Weather',
    component: Weather,
    meta: {
      title: '天气预报',
      keepAlive: false,
    },
  },
  {
    path: '/login',
    name:'Login',
    component:Login
  },
  {
    path: '/register',
    name:'Register',
    component:Register
  },
  { path: '/:pathMatch(.*)*', component: NotFound },
];

export default routes;
